<?php

namespace App\Http\Middleware;
use Session,Config;
use Closure;

class LoginMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if(Session::get(Config::get('custom.setting.MEMBER_TOKEN')))
        {
            return $next($request);

        }else{
            echo "<script>confirm('未登录, 是否立即登录？')?location.href='/login' : history.back() ;</script>";
            exit();
        }
    }
}
